<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../jquery-3.3.1.min.js"></script>
    <style>
        #container{
            width: 1000px;
            margin: 0 auto;
            border:2px solid red;
        }
        #butlist{
            position: relative;
            left: 200px;
        }
        #img{
            width:150px;
            position: relative;
            left: 10px;
        }
        #img2{
            width:150px;
            position: relative;
            left: 10px;
        }

    </style>
</head>
<body>
    <div id="container">
        <div>
            <img id='img' src="../1-1/img/ray.jpg" alt="">
        </div>
    </div>
    <div id="butlist"><input type="button" value="after" id="after"></div>
    
</body>
<script>
    $('#after').click(function(){
        var $img2 = $("<img src = '../1-1/img/ray.jpg' id = 'img2'>");
        //$('#img').after($img2);//在选中的img 后面添加
        $('#img').before($img2);//在选中的img 前面添加
    })
</script>
</html>